package leetcode;

import java.util.LinkedList;
import java.util.Queue;

/**
 * @创建人 MBY381
 * @创建时间 2022/4/14 22:12
 * @描述 暂无
 */
public class Solution225 {
    public static void main(String[] args) {
        Solution225 solution=new Solution225();
        solution.queue1 = new LinkedList<Integer>();
        solution.queue2 = new LinkedList<Integer>();
    }
    Queue<Integer> queue1;
    Queue<Integer> queue2;

    /** Initialize your data structure here. */




    /** Push element x onto stack. */
    public void push(int x) {
        queue2.offer(x);
        while (!queue1.isEmpty()) {
            queue2.offer(queue1.poll());
        }
        Queue<Integer> temp = queue1;
        queue1 = queue2;
        queue2 = temp;
    }

    /** Removes the element on top of the stack and returns that element. */
    public int pop() {
        return queue1.poll();
    }

    /** Get the top element. */
    public int top() {
        return queue1.peek();
    }

    /** Returns whether the stack is empty. */
    public boolean empty() {
        return queue1.isEmpty();
    }
}
